import { onMounted, nextTick, ref } from 'vue';
import { setTableMaxHeight } from '@/utils/common';

type containerOps = {
    id?: string;
    offsetBottom?: number;
};

// 设置table的自适应高度值
export default function useTableSetting({ id = 'xc-table', offsetBottom = 120 }: containerOps = {}) {
    const maxTableHeight = ref(0);
    onMounted(async () => {
        setTimeout(() => {
            maxTableHeight.value = setTableMaxHeight(id, offsetBottom);
        }, 200);
    });
    return {
        maxTableHeight,
        setTableMaxHeight,
    };
}
